<?php
class SearchAction extends BaseAction{
    function index(){
        $this->display();
    }
    function search(){
        //提交表单
        $searchType=$_POST['searchType'];
        $keyword=$_POST['keyword'];
        $newsPost=M('newsarticles')->where("{$searchType} like '%{$keyword}%'")->select();
        
        $this->assign('newsPost',$newsPost);
        $this->display('index');
    }
    
}